# -*- coding: utf-8 -*-
# @Time     :2021/10/22 16:21
# @Author   : master
# @Software : PyCharm


import requests


class HttpRequest():
    @staticmethod
    def http_request(url, data, http_method, cookies, header=None):
        try:
            if http_method.upper() == 'GET':
                res = requests.get(url, params=data, verify=False)
            elif http_method.upper() == 'POST':
                res = requests.request(url=url, headers=header, method=http_method, json=data, verify=False)
            else:
                print('输入的请求方式错误')
        except Exception as e:
            print('请求报错了：{0}'.format(e))
            raise e
        return res
